package com.exam.alibaba;

import java.util.Scanner;

/**
 * date:
 * description:
 */
public class Solution001 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int res = 0;
        for (int i = 0; i < n; i++) {
            int A = scanner.nextInt();
            int B = scanner.nextInt();
            int num = ((A - 2) * B + 2) * (B + 1) / 2;
            res += num;
        }
        System.out.println(res);
    }
}
